package com.zhuxi.filter;

import com.zhuxi.util.RequestIpHolder;
import org.apache.dubbo.common.constants.CommonConstants;
import org.apache.dubbo.common.extension.Activate;
import org.apache.dubbo.rpc.*;

@Activate(group = CommonConstants.CONSUMER)
public class TransportIPFilter implements Filter {
    @Override
    public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
        org.apache.dubbo.rpc.RpcContext.getContext().getAttachments().put(RequestIpHolder.RQUEST_IP,RequestIpHolder.t.get());
        return invoker.invoke(invocation);
    }
}
